<template>
  <div class="survey-container">
    <!-- 语言切换按钮 -->
    <div class="language-switcher-container">
      <LanguageSwitcher type="text" custom-class="language-switcher-btn" />
    </div>
    
    <div class="survey-card">
      <!-- 问卷标题 -->
      <div class="survey-title-section">
        <h1 class="survey-main-title">{{ getCurrentText('问卷调查', 'Survey Questionnaire') }}</h1>
        <p class="survey-subtitle">{{ getCurrentText('请认真填写以下问题，您的反馈对我们很重要', 'Please carefully answer the following questions. Your feedback is important to us') }}</p>
      </div>
      
      <!-- 进度条 -->
      <div class="progress-section">
        <div class="progress-bar">
          <div class="progress-fill" :style="{ width: progressPercentage + '%' }"></div>
        </div>
        <div class="progress-text">{{ currentStep }}/{{ totalSteps }}</div>
      </div>
      
      <div v-for="(item, index) in wjListData" :key="index">
        <!-- 单选 -->
        <div class="question-section" v-if="item.type === 1 && item.is_show">
          <div class="question-header">
            <h2 class="question-title">{{ getCurrentText(item.title,item.e_title) }}</h2>
          </div>
          <div class="radio-group">
            <label class="radio-item" :class="{ active: item.value === option.id }" v-for="(option,kndex) in item.da_an" :key="kndex" @click="handleRadioChange1(index,kndex)">
              <input type="radio" name="gender" :value="option.id" v-model="item.value" class="radio-input">
              <span class="radio-custom"></span>
              <div class="radio-content">
                <span class="radio-label">{{ getCurrentText(option.title,option.e_title) }}</span>
              </div>
            </label>
          </div>
        </div>
        
        <!-- 多选 -->
        <div class="question-section" v-if="item.type === 2 && item.is_show">
          <div class="question-header">
            <h2 class="question-title">{{ getCurrentText(item.title,item.e_title) }}</h2>
          </div>
          <div class="checkbox-group">
            <label class="checkbox-item" :class="{ active: item.value.indexOf(option.id) > -1 }"  v-for="(option,kndex) in item.da_an" :key="kndex">
              <input type="checkbox" :value="option.id"  class="checkbox-input" @change="handleRadioChange2(index,kndex)">
              <span class="checkbox-custom"></span>
              <div class="checkbox-content">
                <span class="checkbox-label">{{ getCurrentText(option.title,option.e_title) }}</span>
              </div>
            </label>
          </div>
        </div>
        
        <!-- 输入框 -->
        <div class="question-section" v-if="item.type === 3 && item.is_show">
          <div class="question-header">
            <h2 class="question-title">{{ getCurrentText(item.title,item.e_title) }}</h2>
          </div>
          <div class="input-section">
            <div class="text-input-wrapper">
              <input type="text" v-model="item.value" class="text-input" :placeholder="getCurrentText('请输入','Please input')">
            </div>
          </div>
        </div>
        
        <!-- 出生日期 -->
        <div class="question-section" v-if="item.type === 4 && item.is_show">
          <div class="question-header">
            <h2 class="question-title">{{ getCurrentText(item.title,item.e_title) }}</h2>
          </div>
          <div class="date-inputs">
            <div class="date-group">
              <label class="date-label">{{ getCurrentText('年','Year') }}</label>
              <div class="date-input-wrapper">
                <input type="number" v-model="item.value[0]" class="date-input" placeholder="1990" min="1900" max="2025">
              </div>
            </div>
            <div class="date-group">
              <label class="date-label">{{ getCurrentText('月','Month') }}</label>
              <div class="date-input-wrapper">
                <input type="number" v-model="item.value[1]" class="date-input" placeholder="1" min="1" max="12">
              </div>
            </div>
            <div class="date-group">
              <label class="date-label">{{ getCurrentText('日','Day') }}</label>
              <div class="date-input-wrapper">
                <input type="number" v-model="item.value[2]" class="date-input" placeholder="1" min="1" max="31">
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 完成页面 -->
      <div v-if="num === wjListData.length+1" class="question-section">
        <div class="completion-section">
          <div class="completion-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M20 6L9 17l-5-5" />
            </svg>
          </div>
          <h2 class="completion-title">{{ getCurrentText('问卷完成！', 'Survey Completed!') }}</h2>
          <p class="completion-subtitle">{{ getCurrentText('感谢您参与我们的问卷调查', 'Thank you for participating in our survey') }}</p>
        </div>
      </div>

      <!-- 操作按钮 -->
      <div class="action-buttons">
        <button v-if="currentStep < wjListData.length+1" @click="nextStep" class="btn btn-primary" >
          {{ currentStep === wjListData.length ? getCurrentText('完成', 'Complete') : getCurrentText('下一步', 'Next') }}
        </button>
      </div>
    </div>
  </div>
</template>

<script>
import { wjList, saveWj } from '@/api/index.js'
import { fa } from 'element-plus/es/locales.mjs'
import LanguageSwitcher from '../components/LanguageSwitcher.vue'

export default {
  name: 'Survey',
  components: {
    LanguageSwitcher
  },
  data() {
    return {
      currentStep: 1,
      totalSteps: 4,
      num:1,
      wjListData: [] // 存储问卷列表数据
    }
  },
  computed: {
    progressPercentage() {
      return (this.currentStep / this.totalSteps) * 100
    },
    
    currentLanguage() {
      return this.$store.getters.currentLanguage
    }
  },
  mounted() {
    // 组件挂载时获取问卷列表数据
    this.getWjList()
  },
  methods: {  
    getCurrentText(chineseText, englishText) {
      if (!chineseText || !englishText) return chineseText || englishText || ''
      return this.currentLanguage === 'zh' ? chineseText : englishText
    },
    
    // 将日期数组转换为时间戳
    convertDateArrayToTimestamp(dateArray) {
      if (!Array.isArray(dateArray) || dateArray.length !== 3) {
        return null;
      }
      
      const year = parseInt(dateArray[0]);
      const month = parseInt(dateArray[1]) - 1; // 月份需要减1，因为Date构造函数中月份是0-11
      const day = parseInt(dateArray[2]);
      
      // 验证日期是否有效
      if (isNaN(year) || isNaN(month) || isNaN(day)) {
        return null;
      }
      
      // 创建Date对象
      const date = new Date(year, month, day);
      
      // 验证日期是否有效（比如2月30日这种无效日期）
      if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) {
        return null;
      }
      
      // 返回时间戳（毫秒）
      return date.getTime();
    },
    
    handleRadioChange1(index1,index2) {
      this.wjListData[index1].value = this.wjListData[index1].da_an[index2].id
    },
    handleRadioChange2(index1,index2){
      console.log('xxxxx');
      
      if(this.wjListData[index1].value.indexOf(this.wjListData[index1].da_an[index2].id) > -1){
        console.log(1111);
        
        this.wjListData[index1].value.splice(this.wjListData[index1].value.indexOf(this.wjListData[index1].da_an[index2].id),1)
      }else{
        console.log(2222);
        this.wjListData[index1].value.push(this.wjListData[index1].da_an[index2].id)
      }
    },
    // 提交问卷数据
    async submitSurvey(user_wj) {
      try {
        const response = await saveWj({ user_wj })
        if (response && response.data) {
          this.wjListData[this.currentStep-1].is_show = false
          this.num++
          // 提交成功后跳转到首页
          setTimeout(() => {
            this.$router.push('/')
          }, 3000)
        }
      } catch (error) {
        console.error('提交问卷失败:', error)
        // 可以在这里添加错误提示

      }
    },
    // 获取问卷列表数据
    async getWjList() {
      try {
        const response = await wjList({})
        if (response && response.data) {
          response.data.forEach(item => {
            item.is_show = false
            if(item.type === 2||item.type === 4){
              item.value = []
            }else{
              item.value = ''
            }
          })
          response.data[this.currentStep-1].is_show = true
          this.wjListData = response.data
          this.totalSteps = response.data.length
        }
      } catch (error) {
        ElMessage.error({
          message: getCurrentText('获取问卷列表失败', 'Get survey list failed'),
          offset: 100,
          duration: 5000
        })
      }
    },
    nextStep() {
      console.log(this.currentStep);
      if(this.currentStep === this.wjListData.length){
       
        let user_wj = []
        this.wjListData.forEach(item => {
          console.log(item.value);
          if(item.type===1){
            user_wj.push({
              id:item.id,
              value:item.value,
            })
          }else if(item.type===2){
            user_wj.push({
              id:item.id,
              value:item.value.join(',')
            })
          }else if(item.type===3){
            user_wj.push({
              id:item.id,
              value:item.value,
            })
          }else if(item.type===4){
            // 使用新方法将日期数组转换为时间戳
            const timestamp = this.convertDateArrayToTimestamp(item.value);
            user_wj.push({
              id: item.id,
              value: timestamp ? timestamp.toString() : item.value.join(',')
            })
          }
        })
        
        // 调用API提交问卷数据
        this.submitSurvey(user_wj);
        
        return false
      }
      
     if(this.wjListData[this.currentStep-1].value){
      this.wjListData[this.currentStep].is_show = true
      this.wjListData[this.currentStep-1].is_show = false
      this.currentStep++
      this.num++
     }
    },
  }
}
</script>

<style lang="scss" scoped>
// 基础样式
.survey-container {
  position: relative;
  min-height: 100vh;
  background-image: url('../assets/bbbggg.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.language-switcher-container {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  
  .language-switcher-btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #667eea;
    transition: all 0.3s ease;
    
    &:hover {
      background: rgba(255, 255, 255, 1);
      color: #5a6fd8;
      transform: translateY(-1px);
    }
  }
  
  // 移动端样式
  @media (max-width: 768px) {
    top: 15px;
    right: 15px;
    
    .language-switcher-btn {
      padding: 6px 12px;
      font-size: 12px;
    }
  }
}

.survey-container {

  // 桌面端样式
  @media (min-width: 1200px) {
    padding: 40px;
  }

  // 平板端样式
  @media (min-width: 769px) and (max-width: 1199px) {
    padding: 30px;
  }

  // 移动端样式
  @media (max-width: 768px) {
    padding: 16px;
    background-image: url('../assets/bbbggg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
  }
}



.survey-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 40px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  max-width: 600px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;

  // 桌面端样式
  @media (min-width: 1200px) {
    max-width: 700px;
    padding: 50px;
    border-radius: 24px;
    box-shadow: 
      0 25px 50px rgba(0, 0, 0, 0.12),
      0 10px 20px rgba(0, 0, 0, 0.06),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  // 平板端样式
  @media (min-width: 769px) and (max-width: 1199px) {
    max-width: 650px;
    padding: 45px;
    border-radius: 22px;
  }

  // 移动端样式
  @media (max-width: 768px) {
    padding: 24px 20px;
    border-radius: 16px;
    margin: 0 12px;
    max-height: 85vh;
  }

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    border-radius: inherit;
    pointer-events: none;
  }

  // 隐藏滚动条
  &::-webkit-scrollbar {
    display: none;
  }
  
}

.survey-title-section {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px; /* Add some space above the progress bar */

  // 桌面端样式
  @media (min-width: 1200px) {
    margin-bottom: 45px;
    padding-top: 30px;
  }

  // 平板端样式
  @media (min-width: 769px) and (max-width: 1199px) {
    margin-bottom: 40px;
    padding-top: 25px;
  }

  // 移动端样式
  @media (max-width: 768px) {
    margin-bottom: 30px;
    padding-top: 15px;
  }

  .survey-main-title {
    font-size: 28px;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 15px;
    letter-spacing: -0.5px;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 32px;
      margin-bottom: 20px;
    }

    // 平板端样式
    @media (min-width: 769px) and (max-width: 1199px) {
      font-size: 26px;
      margin-bottom: 12px;
    }

    @media (max-width: 768px) {
      font-size: 22px;
      margin-bottom: 10px;
    }
  }

  .survey-subtitle {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    letter-spacing: 0.3px;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 18px;
    }

    // 平板端样式
    @media (min-width: 769px) and (max-width: 1199px) {
      font-size: 17px;
    }

    @media (max-width: 768px) {
      font-size: 15px;
    }
  }
}

.progress-section {
  margin-bottom: 40px;
  text-align: center;

  // 桌面端样式
  @media (min-width: 1200px) {
    margin-bottom: 45px;
  }

  .progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);

    // 桌面端样式
    @media (min-width: 1200px) {
      height: 10px;
      border-radius: 5px;
    }
  }

  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: inherit;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
      animation: shimmer 2s infinite;
    }
  }

  .progress-text {
    font-size: 14px;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.5px;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 15px;
    }
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.question-section {
  margin-bottom: 35px;
  animation: fadeInUp 0.6s ease-out;

  // 桌面端样式
  @media (min-width: 1200px) {
    margin-bottom: 40px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-header {
  text-align: center;
  margin-bottom: 30px;

  .question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;

    // 桌面端样式
    @media (min-width: 1200px) {
      width: 60px;
      height: 60px;
      font-size: 20px;
      margin-bottom: 25px;
    }

    @media (max-width: 768px) {
      width: 45px;
      height: 45px;
      font-size: 16px;
      margin-bottom: 18px;
    }

    &::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
      transform: rotate(45deg);
      animation: shine 3s infinite;
    }
  }

  .question-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1.4;
    letter-spacing: -0.5px;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 26px;
    }

    // 平板端样式
    @media (min-width: 769px) and (max-width: 1199px) {
      font-size: 24px;
    }

    @media (max-width: 768px) {
      font-size: 20px;
      line-height: 1.3;
    }
  }
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.radio-group,
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 16px;

  // 桌面端样式
  @media (min-width: 1200px) {
    gap: 20px;
  }
}

.radio-item,
.checkbox-item {
  display: flex;
  align-items: center;
  padding: 20px;
  border: 2px solid #e8e8e8;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: #fafbfc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

  // 桌面端样式
  @media (min-width: 1200px) {
    padding: 24px;
    border-radius: 18px;
  }

  &:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
  }

  &.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
  }
}

.radio-input,
.checkbox-input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-custom,
.checkbox-custom {
  width: 22px;
  height: 22px;
  border: 2px solid #ccc;
  border-radius: 50%;
  margin-right: 16px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
  background: white;

  // 桌面端样式
  @media (min-width: 1200px) {
    width: 24px;
    height: 24px;
    margin-right: 18px;
  }
}

.radio-content,
.checkbox-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
}

.checkbox-custom {
  border-radius: 6px;
}

.radio-item.active .radio-custom {
  border-color: #667eea;
  background: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);

  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: scaleIn 0.2s ease-out;
  }
}

.checkbox-item.active .checkbox-custom {
  border-color: #667eea;
  background: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);

  &::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    animation: scaleIn 0.2s ease-out;
  }
}

@keyframes scaleIn {
  from {
    transform: translate(-50%, -50%) scale(0);
  }
  to {
    transform: translate(-50%, -50%) scale(1);
  }
}

.radio-label,
.checkbox-label {
  font-size: 16px;
  color: #2c3e50;
  font-weight: 600;
  line-height: 1.4;

  // 桌面端样式
  @media (min-width: 1200px) {
    font-size: 17px;
  }

  @media (max-width: 768px) {
    font-size: 15px;
  }
}

.input-section {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.text-input-wrapper {
  width: 100%;
  max-width: 400px;

  // 桌面端样式
  @media (min-width: 1200px) {
    max-width: 500px;
  }
}

.text-input {
  width: 100%;
  height: 55px;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: #2c3e50;
  transition: all 0.3s ease;
  background: #fafbfc;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

  // 桌面端样式
  @media (min-width: 1200px) {
    height: 60px;
    font-size: 17px;
    border-radius: 14px;
  }

  @media (max-width: 768px) {
    height: 50px;
    font-size: 15px;
    border-radius: 10px;
  }

  &:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
  }

  &::placeholder {
    color: #bdc3c7;
  }
}

.date-inputs {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 20px;

  // 桌面端样式
  @media (min-width: 1200px) {
    gap: 25px;
  }

  // 移动端样式
  @media (max-width: 768px) {
    gap: 15px;
    flex-wrap: wrap;
  }
}

.date-group {
  display: flex;
  flex-direction: column;
  align-items: center;

  .date-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 15px;
      margin-bottom: 12px;
    }

    @media (max-width: 768px) {
      font-size: 13px;
      margin-bottom: 8px;
    }
  }

  .date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;

    .date-input {
      width: 80px;
      height: 50px;
      border: 2px solid #e8e8e8;
      border-radius: 12px;
      text-align: center;
      font-size: 16px;
      font-weight: 600;
      color: #2c3e50;
      transition: all 0.3s ease;
      background: #fafbfc;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

      // 桌面端样式
      @media (min-width: 1200px) {
        width: 90px;
        height: 55px;
        font-size: 17px;
        border-radius: 14px;
      }

      @media (max-width: 768px) {
        width: 70px;
        height: 45px;
        font-size: 15px;
        border-radius: 10px;
      }

      &:focus {
        outline: none;
        border-color: #667eea;
        background: white;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(102, 126, 234, 0.15);
        transform: translateY(-1px);
      }

      &::placeholder {
        color: #bdc3c7;
      }
    }
  }
}

.completion-section {
  text-align: center;
  padding: 40px 20px;

  .completion-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    font-weight: bold;
    margin: 0 auto 30px;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
    animation: bounceIn 0.8s ease-out;

    // 桌面端样式
    @media (min-width: 1200px) {
      width: 100px;
      height: 100px;
      font-size: 50px;
      margin-bottom: 35px;
    }

    // 平板端样式
    @media (min-width: 769px) and (max-width: 1199px) {
      width: 90px;
      height: 90px;
      font-size: 45px;
      margin-bottom: 32px;
    }

    @media (max-width: 768px) {
      width: 70px;
      height: 70px;
      font-size: 35px;
      margin-bottom: 25px;
    }

    svg {
      width: 60%;
      height: 60%;
    }
  }

  .completion-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 12px;
    animation: fadeInUp 0.8s ease-out 0.2s both;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 28px;
      margin-bottom: 15px;
    }

    // 平板端样式
    @media (min-width: 769px) and (max-width: 1199px) {
      font-size: 26px;
    }

    @media (max-width: 768px) {
      font-size: 22px;
      margin-bottom: 10px;
    }
  }

  .completion-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    animation: fadeInUp 0.8s ease-out 0.4s both;

    // 桌面端样式
    @media (min-width: 1200px) {
      font-size: 18px;
      margin-bottom: 35px;
    }

    // 平板端样式
    @media (min-width: 769px) and (max-width: 1199px) {
      font-size: 17px;
      margin-bottom: 32px;
    }

    @media (max-width: 768px) {
      font-size: 15px;
      margin-bottom: 25px;
    }
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.action-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 40px;

  // 桌面端样式
  @media (min-width: 1200px) {
    gap: 25px;
    margin-top: 45px;
  }
}

.btn {
  padding: 16px 40px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 140px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;

  // 桌面端样式
  @media (min-width: 1200px) {
    padding: 18px 45px;
    font-size: 17px;
    border-radius: 14px;
    min-width: 160px;
  }

  @media (max-width: 768px) {
    padding: 14px 35px;
    font-size: 15px;
    min-width: 120px;
  }

  &.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);

    &:hover:not(:disabled) {
      transform: translateY(-3px);
      box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    }

    &:active:not(:disabled) {
      transform: translateY(-1px);
      box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
      box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    }

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
      transition: left 0.5s;
    }

    &:hover::before {
      left: 100%;
    }
  }
}

// 移动端样式优化
@media (max-width: 768px) {
  .survey-container {
    padding: 16px 12px;
  }

  .survey-card {
    padding: 24px 20px;
    margin: 0 8px;
    border-radius: 16px;
  }

  .survey-title-section {
    margin-bottom: 25px;
    padding-top: 10px;
  }

  .survey-main-title {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .survey-subtitle {
    font-size: 14px;
    line-height: 1.5;
  }

  .question-header .question-title {
    font-size: 20px;
  }

  .radio-item,
  .checkbox-item {
    padding: 18px;
    border-radius: 14px;
  }

  .radio-custom,
  .checkbox-custom {
    width: 20px;
    height: 20px;
    margin-right: 14px;
  }

  .radio-label,
  .checkbox-label {
    font-size: 15px;
  }

  .date-inputs {
    gap: 15px;
  }

  .date-group .date-input {
    width: 70px;
    height: 45px;
    font-size: 15px;
  }

  .action-buttons {
    gap: 15px;
    flex-direction: column;
    align-items: center;
  }

  .btn {
    padding: 16px 35px;
    font-size: 15px;
    min-width: 160px;
    width: 100%;
    max-width: 250px;
  }
}

// 超小屏幕优化
@media (max-width: 480px) {
  .survey-container {
    padding: 12px 8px;
  }

  .survey-card {
    padding: 20px 16px;
    margin: 0 6px;
    border-radius: 14px;
  }

  .question-header .question-title {
    font-size: 18px;
  }

  .question-number {
    width: 40px;
    height: 40px;
    font-size: 14px;
    margin-bottom: 15px;
  }

  .radio-item,
  .checkbox-item {
    padding: 16px;
    border-radius: 12px;
  }

  .date-inputs {
    gap: 12px;
  }

  .date-group .date-input {
    width: 65px;
    height: 42px;
    font-size: 14px;
  }

  .completion-icon {
    width: 60px;
    height: 60px;
    font-size: 30px;
    margin-bottom: 20px;
  }

  .completion-title {
    font-size: 20px;
  }

  .completion-subtitle {
    font-size: 14px;
  }
}

// 平板端横屏优化
@media (min-width: 769px) and (max-width: 1199px) and (orientation: landscape) {
  .survey-card {
    max-height: 70vh;
  }
}

// 高分辨率屏幕优化
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .survey-card {
    border-width: 0.5px;
  }
  
  .radio-custom,
  .checkbox-custom {
    border-width: 1px;
  }
}
</style>
